package com.hackintosh.abstractFactory;

import javax.swing.*;
import java.awt.*;

/**
 * @description：
 * @author：twislyn
 * @date：Created in 2021/05/08
 * @modified By：
 * @version: 1.0
 */
public class Vegetables implements Plant {
    JScrollPane sp;
    JFrame jf = new JFrame("抽象工厂模式测试");

    public Vegetables() {
        Container contentPane = jf.getContentPane();
        JPanel p1 = new JPanel();
        p1.setLayout(new GridLayout(1, 1));
        p1.setBorder(BorderFactory.createTitledBorder("植物：蔬菜"));
        sp = new JScrollPane(p1);
        contentPane.add(sp, BorderLayout.CENTER);
        JLabel l1 = new JLabel(new ImageIcon(this.getClass().getClassLoader().getResource("P_Vegetables.jpg")));
        p1.add(l1);
        jf.pack();
        jf.setVisible(false);
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);    //用户点击窗口关闭
    }

    @Override
    public void show() {
        jf.setVisible(true);
    }
}
